<template>
		<!-- <uni-nav-bar dark color="#999" backgroundColor="#f5f5f5" shadow @clickLeft="backFn" left-icon="left" leftText="返回" title="记录" /> -->
		<view class="balance_card">
			<view class="balance_label">交易记录</view>
			<view class="balance_list" v-for="(item,index) in list" :key="index">
				<view class="flex1">
					<view>{{item.flow_type}}</view>
					<view>
						<text>{{item.flow_status=='支出' ? '-':'+'}}</text>
					    <text>{{item.money}}</text>
					</view>
				</view>
				<view  class="balabce_time">{{item.create_time}}</view>
			</view>
			<view v-if="list.length==0" style="text-align: center;margin: 100px;">当前无数据</view>
			
			
		</view>
</template>

<script setup>
	import { computed ,ref,reactive,toRefs} from 'vue';
	import { onLoad,onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
	import sheep from '@/sheep';
	
	const list=ref()
	list.value=[]
	const userInfo=ref()
	
	onLoad(()=>{  
		userInfo.value=sheep.$store('user').userInfo
	
		if(uni.getStorageSync('token')){
			balanceList(userInfo.value.id)
		}
		// console.log(userInfo.value);
		// console.log(userInfo.value.userInfo.id);
	})
	
	const balanceList=(value)=>{
		console.log(value);
		sheep.$api.login.balancelist({userId:value}).then(res=>{
			console.log(res);
			console.log('1--1-1-1');
			list.value=res.data.list
		})
	}
	
	const backFn=()=>{
		uni.navigateBack({detal:1})
	}
</script>

<style lang="scss" scoped>
	page{
		padding-top: 20rpx;
	}
	.balance_label{
		padding: 20rpx;
		font-size: 26rpx;
		background-color: #f8b5c5;
		color: #fff;
		display: inline-block;
		border-radius: 15rpx;
		margin: 30rpx 20rpx;
	}
	.balance_card{
		margin: 30rpx;
		background-color: #fff;
		padding: 20rpx 0;
	}
	.balance_list{
		margin: 20rpx;
	}
	.flex1{
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.balabce_time{
		font-size: 24rpx;
		margin-top: 20rpx;
		padding-left: 12;
	}
</style>